--[[/**
-- * 
 * 蕾拉生命值每损失[0]%，提高[1]属性[2]。
-- *
-- */]]

---@class BuffEffect55100 : BaseBuffEffect
BuffEffect55100 = ClientFight.CreateClass("BuffEffect55100", ClientFight.BaseBuffEffect)
local t = BuffEffect55100

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local fighter = buff.target;
    local effectValue = buff.buffBean.f_BuffEffectValue;
    local nowHp = fighter.hp;
    local maxHp = FighterAttributeManager.getFightAttr(fighter, FighterAttributeEnum.HP);
    local losePercent = 10000 - nowHp * 1 / maxHp * 10000;
    local add = (losePercent / effectValue[1]);
    if (add > 0) then
        buff.attributes.attributes[effectValue[2]] = effectValue[3] * add;
    end
    SkillRoleMgr.savePathFile(string.format("[%s][EFFECT]Fighter %s Buff%s 损失%s万分比的血量,增加%s的属性",
            fight.frame, fighter.fighterId, buff.modelId, losePercent, effectValue[3] * add
    ));
    ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
    return IBuffEffect.SUCCESS_ATTRI_HAS_CHANGE;
end

t.New()